package com.yxw.live_vod_facade.feign;

import com.yxw.live_vod_facade.dto.FileDTO;
import com.yxw.live_vod_facade.vo.YxFileVo;
import com.yxw.yxnet_cd_center.common.utils.BaseResult;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

@FeignClient(name = "live-vod-boot", contextId = "file")
public interface FileFeignClient {

    @PostMapping(value = "/file/upload_file", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    @ApiOperation(value = "上传文件")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "form",name = "multipartFiles", value = "文件流结集合", required = true, dataType = "__file",allowMultiple = true),
            @ApiImplicitParam(name = "objId", value = "图片对应主体的ID", required = true),
            @ApiImplicitParam(name = "classify", value = "文件类型：1-视频 2：图片/文件", required = true),
            @ApiImplicitParam(name = "remark", value = "备注", required = true)
    })
    public BaseResult<List<YxFileVo>> uploadFile(@RequestPart("multipartFiles") MultipartFile[] multipartFiles,
                                                 @RequestParam("objId") Long objId,
                                                 @RequestParam("classify") Integer classify,
                                                 @RequestParam("remark") String remark);

    @DeleteMapping(value = "/file/deleteFile")
    @ApiOperation(value = "文件删除")
    public BaseResult<Boolean> deleteFile(@RequestBody FileDTO dto);

    @ApiOperation(value = "文件下载/预览")
    @PostMapping(value = "/file/downloadFile")
    public BaseResult<String> downloadFile(@RequestBody FileDTO Dto);

    @ApiOperation(value = "获取对应业务ID的文件信息列表")
    @PostMapping(value = "/file/getFileListByBussId")
    public BaseResult<List<YxFileVo>> getFileListByBussId(@RequestParam("bussId") Long bussId);
}
